<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    // var a = [];
    // console.dir(a);

    // console.dir(Array);
    // console.dir(String);
    // console.dir(Date);
    // console.dir(RegExp);
    // console.dir(Promise);

    Array.prototype.say = function () {
        // this -> 调用此方法的实例化对象
        console.log("嘿嘿", ...this);
    }
    Array.prototype.myEach = function (fn) {
        // this -> 调用此方法的实例化对象
        for (var i = 0; i < this.length; i++) {
            var item = this[i];
            var index = i;
            var array = this;
            fn(item, index, array);
        }
    }

    var arr = new Array(1, 2, 3, 4);
    // console.log(arr);
    // console.log(arr.constructor);
    // arr.say();

    arr.myEach(function (item, index, array) {
        console.log(item, index, array);
    });
    console.log(arr);

    // var brr = ["a", "b", "c"];
    // console.log(brr);



</script>

</html>